<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<%@include file="/comm/pub.inc"%>
		<script type="text/javascript" src="<%=contextPath %>/web/system/pub.js" ></script>
		<style type="text/css">
		    html, body{
		        margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;
		    }    
	    </style>
	</head>
	<body>
		<div id="datagrid" class="mini-datagrid" style="width:100%;height:100%;"
			showPager=false virtualScroll="true" sortMode="client" >
		</div> 
	</body>
	<script type="text/javascript" >
		$(function(){
			var grid = mini.get('datagrid'),
				resultSql = window.parent && window.parent.ResultSql;
			$.ajax({
				url:contextPath+"/action/report/queryBySql",
				async:false,
				dataType:"json",
				type:"post",
				data:{sql:resultSql},
				success:function(json){
					
					if (!NOT_EMPTY(json))
						return;
					if (json.error){
						mini.alert(json.result,"错误",function(){
							window.parent.closeSqlResutWin();
						});
						return;
					}
					if (json.columns){
						var columns = [];
						$.each(json.columns,function(){
							columns.push({field:this,name:this,header:this,allowSort:true})
						});
						grid.set({columns:columns,data:json.datas});
					}
				}
			});
		})
		
	</script>
</html>
